/*
 * token_list.h
 *
 * Group: Fantastic Five
 * Date: 4/25/08
 *
 * Description: Header file for linked list of tokens
 */

#include <stdio.h>
#include <stdlib.h>
#include "globals.h"

/* Define token */
struct token
{
    struct token *next;
    struct token *prev;
    union value v;
    enum lexeme type;
    int linenum;
};

/* Define token list */
struct token_list
{
    struct token *head;
    struct token *tail;
    int count;
};

/* mallocs and initializes a new token list */
struct token_list * new_token_list();

/* mallocs and initializes a new token */
struct token * new_token(int, union value, enum lexeme);

/* Pushes token onto back of token list */
void push_token(struct token *, struct token_list *);

/* Pops off token at beginning of token list and returns it */
struct token * pop_token(struct token_list *);

/* Removes token rem from token list */
void remove_token(struct token *, struct token_list *);

/* Checks to see if list contains tokens, return 1 if empty, 0 if not */
int no_tokens(struct token_list *);

/* Removes all tokens from list */
void empty_token_list(struct token_list *);
